package main

import (
    "fmt"
)

var loaderstr = []byte{0x47, 0x12, 0x34, 0x02}

type tsHead struct {
   sync byte
   pid uint16
   order byte
}


func parse_head(a []byte, b *tsHead)  {
	b.sync = a[0]
	b.pid = uint16(a[1]) << 0x8 | uint16(a[2])
	b.pid &= 0x1fff
	b.order = a[3]
}




func main() {
   var pts tsHead 
   parse_head(loaderstr, &pts)
    
   fmt.Println(pts.sync, pts.pid)

}
